//
//  MXMineCommonV.m
//  HNBaseProject
//
//  Created by xujie on 2024/6/4.
//

#import "MXMineCommonV.h"

@implementation MXMineCommonV

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self createUI];
    }
    return self;
}

- (void)createUI {
    
    self.userInteractionEnabled = YES;
    
    self.icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 19, 19)];
    [self addSubview:self.icon];
    
    self.nameLab = [[UILabel alloc] init];
    self.nameLab.textColor = [UIColor colorWithHexString:@"#0F0F0F"];
    self.nameLab.font = PFRFontMedium(16);
    [self addSubview:self.nameLab];
    
    UIImageView *rightV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_right"]];
    [self addSubview:rightV];
    
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.icon.mas_right).offset(11);
        make.centerY.mas_equalTo(self.icon);
    }];
    
    [rightV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.icon);
        make.right.offset(0);
        make.height.width.mas_equalTo(12);
    }];
}

-(void)reloadViewWithIcon:(NSString *)icon name:(NSString *)name {
    
    self.nameLab.text = name;
    self.icon.image = [UIImage imageNamed:icon];
}

@end
